﻿using CollegeSim.CourseScheduler.Presentation.Facade;
using System;
using System.Windows.Forms;

namespace CollegeSim.CourseScheduler.Presentation
{
    // Author: Ryan Redburn
    // Project: Course Scheduler
    // Date: 2/15/2014

    public partial class FormMainMenu : Form
    {
        #region [ Fields ]

        private readonly SchedulerFacade _facade;

        #endregion

        #region [ Constructors ]

        // Initialize form resources
        public FormMainMenu(SchedulerFacade facade)
        {
            InitializeComponent();
            _facade = facade;
        }

        #endregion

        #region [ Events ]

        // Opens the form for course management
        private void btnMngCrs_Click(object sender, EventArgs e)
        {
            using (var formMngCrs = new FormCourseManagement(_facade))
            {
                formMngCrs.ShowDialog();
            }
        }

        // OPen the form for managing sessions
        private void btnMngSessions_Click(object sender, EventArgs e)
        {
            using (var formMngSessions = new FormSessionManagement(_facade))
            {
                formMngSessions.ShowDialog();
            }
        }

        // Opens the form for course sign up
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            MessageBox.Show("This feature is not yet implemented.", "Not Implemented");
            // TODO
        }

        // Exits the application on user confirmation
        private void btnExit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to exit?", "Exit Application",
                MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                Application.Exit();
            }
        }

        #endregion
    }
}
